﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ETRobocon.RaceTraking.GamePresentation
{
    /// <summary>
    /// Interaction logic for UserControlDPStatus.xaml
    /// </summary>
    public partial class UserControlDPStatus : UserControl, ETRoboConTrakingSystem.IDifficultPointStatus
    {
        public UserControlDPStatus()
        {
            InitializeComponent();

            specialImages.Add(SpecialImage0);
            specialImages.Add(SpecialImage1);
            specialImages.Add(SpecialImage2);
            specialImages.Add(SpecialImage3);
            specialImages.Add(SpecialImage4);
        }

        private List<Image> specialImages=new List<Image>();

        public void LoadStatusItem(int index, object statusItem)
        {
            index = index - 1;
            if (statusItem is BitmapImage)
            {
                if (index >= 0 && index < specialImages.Count)
                {
                    specialImages[index].Source = statusItem as BitmapImage;
                }
            }
        }

        public void ShowImage(int index)
        {
            index = index - 1;
            foreach (var image in specialImages)
            {
                image.Visibility = System.Windows.Visibility.Hidden;
                if (specialImages.IndexOf(image) == index)
                {
                    image.Visibility = System.Windows.Visibility.Visible;
                }
            }
        }

        public void ResetImage()
        {
            foreach (var image in specialImages)
            {
                image.Visibility = System.Windows.Visibility.Hidden;
            }
        }
    }
}
